Northwoods.GoWPF 2.2.4 Assembly
MakeXElement Method (GraphModelNodeData<NodeKey>)

the name of the new XElement
Constructs a Linq for XML XElement holding the data of this node.
Syntax
Public Overridable Function MakeXElement( _
   ByVal n As XName _
) As XElement
public virtual XElement MakeXElement( 
   XName n
)

Parameters

n
the name of the new XElement

Return Value

an initialized XElement
Remarks

This constructs a new XElement and adds an XAttribute for each simple property that has a value different from its default value. For each property that is a collection, it adds an XElement with nested item elements. This does not add an element if the collection is empty.

Because the NodeKey type might be a type for which we have an implementation to convert to and from strings for XML, this calls the ConvertNodeKeyToString method, which you can override.

This is implemented as: public virtual XElement MakeXElement(XName n) { XElement e = new XElement(n); e.Add(XHelper.Attribute<NodeKey>("Key", this.Key, default(NodeKey), ConvertNodeKeyToString)); e.Add(XHelper.Attribute("Category", this.Category, "")); e.Add(XHelper.Elements<NodeKey>("FromKeys", "Key", this.FromKeys, ConvertNodeKeyToString)); e.Add(XHelper.Elements<NodeKey>("ToKeys", "Key", this.ToKeys, ConvertNodeKeyToString)); e.Add(XHelper.Attribute("IsSubGraph", this.IsSubGraph, false)); e.Add(XHelper.Attribute("IsSubGraphExpanded", this.IsSubGraphExpanded, true)); e.Add(XHelper.Attribute("WasSubGraphExpanded", this.WasSubGraphExpanded, false)); e.Add(XHelper.Attribute<NodeKey>("SubGraphKey", this.SubGraphKey, default(NodeKey), ConvertNodeKeyToString)); e.Add(XHelper.Elements<NodeKey>("MemberKeys", "Key", this.MemberKeys, ConvertNodeKeyToString)); e.Add(XHelper.Attribute("Location", this.Location, new Point(Double.NaN, Double.NaN))); e.Add(XHelper.Attribute("Text", this.Text, "")); return e; }

If you add properties to this node data class, and if you are using the GraphModel<NodeType,NodeKey>.Save<NodeDataType> and GraphModel<NodeType,NodeKey>.Load<NodeDataType> methods, you should override this method to add new attributes and/or elements as needed, and you should override LoadFromXElement.

Requirements
See Also

Reference

GraphModelNodeData<NodeKey> Class
GraphModelNodeData<NodeKey> Members

 

 


© Northwoods Software 2017. All Rights Reserved.

Send Feedback